load("//bazel:mongo_src_rules.bzl", "idl_generator", "mongo_cc_library")

package(default_visibility = ["//visibility:public"])

exports_files(
    glob([
        "*.h",
        "*.cpp",
    ]),
)

mongo_cc_library(
    name = "watchdog",
    srcs = [
        "watchdog.cpp",
    ],
    hdrs = [
        "watchdog.h",
    ],
    deps = [
        "//src/mongo/db:server_base",
        "//src/mongo/db:service_context",  # TODO(SERVER-93876): Remove.
        "//src/mongo/util/concurrency:spin_lock",  # TODO(SERVER-93876): Remove.
    ],
)

mongo_cc_library(
    name = "watchdog_register",
    srcs = [
        "watchdog_register.cpp",
    ],
    hdrs = [
        "watchdog_register.h",
    ],
    deps = [
        "//src/mongo:base",
    ],
)

idl_generator(
    name = "watchdog_mongod_gen",
    src = "watchdog_mongod.idl",
)

mongo_cc_library(
    name = "watchdog_mongod",
    srcs = [
        "watchdog_mongod.cpp",
        "watchdog_mongod_gen",
    ],
    hdrs = [
        "watchdog_mongod.h",
    ],
    deps = [
        ":watchdog",
        ":watchdog_register",
        "//src/mongo/db:server_base",
        "//src/mongo/db:service_context",  # TODO(SERVER-93876): Remove.
        "//src/mongo/db/commands:server_status_core",
        "//src/mongo/db/storage:storage_options",  # TODO(SERVER-93876): Remove.
    ],
)

mongo_cc_library(
    name = "watchdog_mock",
    srcs = [
        "watchdog_mock.cpp",
    ],
    hdrs = ["watchdog_mock.h"],
    deps = [
        ":watchdog",
        "//src/mongo/db:service_context",
    ],
)
